/*
============================================================================
 Name        : KeyLocker.h
 Author      : DANG Zhengfa
 Version     :
 Copyright   : Zhengfa Company Limited
 Description : CKeyLocker declaration
============================================================================
*/

#ifndef KEYLOCKER_H
#define KEYLOCKER_H

#include <e32base.h>	// For CActive, link against: euser.lib
#include <e32std.h>		// For RTimer, link against: euser.lib

#include <aknkeylock.h>  // For RAknKeyLock
#include <saclient.h>    // For RSystemAgent

class CKeyLocker : public CActive
{
public:
	// C++ constructor
	CKeyLocker();
	
	// Second-phase constructor
	void ConstructL();
	
	// Cancel and destroy
	~CKeyLocker();

public: // New functions
	// Function for making the initial request
	void StartL();

private: // From CActive
	// Handle completion
	void RunL();
	
	// Handle error
	TInt RunError(TInt aError);

	// How to cancel me
	void DoCancel();
	
	// Override to handle leaves from RunL(). Default implementation causes
	// the active scheduler to panic.
	//void RunError(TInt aError);

private:


private:
	RTimer	iTimer;		// Provides async timing service
	TTimeIntervalSeconds  iDelaySeconds;
	TBool iEnableNote;
	
	RAknKeyLock iLocker;  // handle to lock keypad
	RSystemAgent iAgent;  // handle to system agent

public:
	void SetTimeInterval(TInt aInterval);
	void SetNote(TBool aFlag);
	void RunLockNow();
	TBool IsKeyLocked(void);
	TBool IsCallActive(void);
};

#endif
